import sys
from PyQt5.QtWidgets import QWidget, QApplication, QTabWidget, QHBoxLayout
from Demo.MyCodeWindow import MyCodeWindow
from PercentBar import PercentBar
from TabWindow import TreeWidget


class MyTabWidgets(QTabWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle('小工具')
        self.tab1 = MyCodeWindow()
        self.tab2 = TreeWidget()
        self.tab3 = QWidget()

        self.bar1 = PercentBar(self.tab3,  size=100, percent=60)
        self.bar2 = PercentBar(self.tab3, size=100, color='red', percent=80)
        self.bar3 = PercentBar(self.tab3, size=200, font=40, color='blue', percent=60)

        self.layout = QHBoxLayout()
        self.layout.addWidget(self.bar1)
        self.layout.addWidget(self.bar2)
        self.layout.addWidget(self.bar3)

        self.tab3.setLayout(self.layout)

        self.addTab(self.tab3, '运行状态')
        self.addTab(self.tab2, '测试页面')
        self.addTab(self.tab1, '运行状态')


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = MyTabWidgets()
    window.show()
    sys.exit(app.exec())
